/******************************************************************************* 
 *  Copyright 2007 Amazon Technologies, Inc.  
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  
 *  You may not use this file except in compliance with the License. 
 *  You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
 *  This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
 *  CONDITIONS OF ANY KIND, either express or implied. See the License for the 
 *  specific language governing permissions and limitations under the License.
 * ***************************************************************************** 
 *    __  _    _  ___ 
 *   (  )( \/\/ )/ __)
 *   /__\ \    / \__ \
 *  (_)(_) \/\/  (___/
 * 
 *  Amazon ECS CSharp Library
 *  API Version: 2007-07-16
 *  Generated: Thu Aug 02 10:15:38 PDT 2007 
 * 
 */

using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Text;


namespace Amazon.ECS.Model
{
    [XmlTypeAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16")]
    [XmlRootAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16", IsNullable = false)]
    public class SellerListing
    {
    
        private String exchangeIdField;

        private String listingIdField;

        private String ASINField;

        private String SKUField;

        private String UPCField;

        private String EANField;

        private Boolean? willShipExpeditedField;

        private Boolean? willShipInternationalField;

        private String titleField;

        private  Price priceField;
        private String startDateField;

        private String endDateField;

        private String statusField;

        private String quantityField;

        private String conditionField;

        private String subConditionField;

        private  Seller sellerField;

        /// <summary>
        /// Gets and sets the ExchangeId property.
        /// </summary>
        [XmlElementAttribute(ElementName = "ExchangeId")]
        public String ExchangeId
        {
            get { return this.exchangeIdField ; }
            set { this.exchangeIdField= value; }
        }



        /// <summary>
        /// Sets the ExchangeId property
        /// </summary>
        /// <param name="exchangeId">ExchangeId property</param>
        /// <returns>this instance</returns>
        public SellerListing WithExchangeId(String exchangeId)
        {
            this.exchangeIdField = exchangeId;
            return this;
        }



        /// <summary>
        /// Checks if ExchangeId property is set
        /// </summary>
        /// <returns>true if ExchangeId property is set</returns>
        public Boolean IsSetExchangeId()
        {
            return  this.exchangeIdField != null;

        }


        /// <summary>
        /// Gets and sets the ListingId property.
        /// </summary>
        [XmlElementAttribute(ElementName = "ListingId")]
        public String ListingId
        {
            get { return this.listingIdField ; }
            set { this.listingIdField= value; }
        }



        /// <summary>
        /// Sets the ListingId property
        /// </summary>
        /// <param name="listingId">ListingId property</param>
        /// <returns>this instance</returns>
        public SellerListing WithListingId(String listingId)
        {
            this.listingIdField = listingId;
            return this;
        }



        /// <summary>
        /// Checks if ListingId property is set
        /// </summary>
        /// <returns>true if ListingId property is set</returns>
        public Boolean IsSetListingId()
        {
            return  this.listingIdField != null;

        }


        /// <summary>
        /// Gets and sets the ASIN property.
        /// </summary>
        [XmlElementAttribute(ElementName = "ASIN")]
        public String ASIN
        {
            get { return this.ASINField ; }
            set { this.ASINField= value; }
        }



        /// <summary>
        /// Sets the ASIN property
        /// </summary>
        /// <param name="ASIN">ASIN property</param>
        /// <returns>this instance</returns>
        public SellerListing WithASIN(String ASIN)
        {
            this.ASINField = ASIN;
            return this;
        }



        /// <summary>
        /// Checks if ASIN property is set
        /// </summary>
        /// <returns>true if ASIN property is set</returns>
        public Boolean IsSetASIN()
        {
            return  this.ASINField != null;

        }


        /// <summary>
        /// Gets and sets the SKU property.
        /// </summary>
        [XmlElementAttribute(ElementName = "SKU")]
        public String SKU
        {
            get { return this.SKUField ; }
            set { this.SKUField= value; }
        }



        /// <summary>
        /// Sets the SKU property
        /// </summary>
        /// <param name="SKU">SKU property</param>
        /// <returns>this instance</returns>
        public SellerListing WithSKU(String SKU)
        {
            this.SKUField = SKU;
            return this;
        }



        /// <summary>
        /// Checks if SKU property is set
        /// </summary>
        /// <returns>true if SKU property is set</returns>
        public Boolean IsSetSKU()
        {
            return  this.SKUField != null;

        }


        /// <summary>
        /// Gets and sets the UPC property.
        /// </summary>
        [XmlElementAttribute(ElementName = "UPC")]
        public String UPC
        {
            get { return this.UPCField ; }
            set { this.UPCField= value; }
        }



        /// <summary>
        /// Sets the UPC property
        /// </summary>
        /// <param name="UPC">UPC property</param>
        /// <returns>this instance</returns>
        public SellerListing WithUPC(String UPC)
        {
            this.UPCField = UPC;
            return this;
        }



        /// <summary>
        /// Checks if UPC property is set
        /// </summary>
        /// <returns>true if UPC property is set</returns>
        public Boolean IsSetUPC()
        {
            return  this.UPCField != null;

        }


        /// <summary>
        /// Gets and sets the EAN property.
        /// </summary>
        [XmlElementAttribute(ElementName = "EAN")]
        public String EAN
        {
            get { return this.EANField ; }
            set { this.EANField= value; }
        }



        /// <summary>
        /// Sets the EAN property
        /// </summary>
        /// <param name="EAN">EAN property</param>
        /// <returns>this instance</returns>
        public SellerListing WithEAN(String EAN)
        {
            this.EANField = EAN;
            return this;
        }



        /// <summary>
        /// Checks if EAN property is set
        /// </summary>
        /// <returns>true if EAN property is set</returns>
        public Boolean IsSetEAN()
        {
            return  this.EANField != null;

        }


        /// <summary>
        /// Gets and sets the WillShipExpedited property.
        /// </summary>
        [XmlElementAttribute(ElementName = "WillShipExpedited")]
        public Boolean WillShipExpedited
        {
            get { return this.willShipExpeditedField.GetValueOrDefault() ; }
            set { this.willShipExpeditedField= value; }
        }



        /// <summary>
        /// Sets the WillShipExpedited property
        /// </summary>
        /// <param name="willShipExpedited">WillShipExpedited property</param>
        /// <returns>this instance</returns>
        public SellerListing WithWillShipExpedited(Boolean willShipExpedited)
        {
            this.willShipExpeditedField = willShipExpedited;
            return this;
        }



        /// <summary>
        /// Checks if WillShipExpedited property is set
        /// </summary>
        /// <returns>true if WillShipExpedited property is set</returns>
        public Boolean IsSetWillShipExpedited()
        {
            return  this.willShipExpeditedField != null;

        }


        /// <summary>
        /// Gets and sets the WillShipInternational property.
        /// </summary>
        [XmlElementAttribute(ElementName = "WillShipInternational")]
        public Boolean WillShipInternational
        {
            get { return this.willShipInternationalField.GetValueOrDefault() ; }
            set { this.willShipInternationalField= value; }
        }



        /// <summary>
        /// Sets the WillShipInternational property
        /// </summary>
        /// <param name="willShipInternational">WillShipInternational property</param>
        /// <returns>this instance</returns>
        public SellerListing WithWillShipInternational(Boolean willShipInternational)
        {
            this.willShipInternationalField = willShipInternational;
            return this;
        }



        /// <summary>
        /// Checks if WillShipInternational property is set
        /// </summary>
        /// <returns>true if WillShipInternational property is set</returns>
        public Boolean IsSetWillShipInternational()
        {
            return  this.willShipInternationalField != null;

        }


        /// <summary>
        /// Gets and sets the Title property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Title")]
        public String Title
        {
            get { return this.titleField ; }
            set { this.titleField= value; }
        }



        /// <summary>
        /// Sets the Title property
        /// </summary>
        /// <param name="title">Title property</param>
        /// <returns>this instance</returns>
        public SellerListing WithTitle(String title)
        {
            this.titleField = title;
            return this;
        }



        /// <summary>
        /// Checks if Title property is set
        /// </summary>
        /// <returns>true if Title property is set</returns>
        public Boolean IsSetTitle()
        {
            return  this.titleField != null;

        }


        /// <summary>
        /// Gets and sets the Price property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Price")]
        public Price Price
        {
            get { return this.priceField ; }
            set { this.priceField = value; }
        }



        /// <summary>
        /// Sets the Price property
        /// </summary>
        /// <param name="price">Price property</param>
        /// <returns>this instance</returns>
        public SellerListing WithPrice(Price price)
        {
            this.priceField = price;
            return this;
        }



        /// <summary>
        /// Checks if Price property is set
        /// </summary>
        /// <returns>true if Price property is set</returns>
        public Boolean IsSetPrice()
        {
            return this.priceField != null;
        }




        /// <summary>
        /// Gets and sets the StartDate property.
        /// </summary>
        [XmlElementAttribute(ElementName = "StartDate")]
        public String StartDate
        {
            get { return this.startDateField ; }
            set { this.startDateField= value; }
        }



        /// <summary>
        /// Sets the StartDate property
        /// </summary>
        /// <param name="startDate">StartDate property</param>
        /// <returns>this instance</returns>
        public SellerListing WithStartDate(String startDate)
        {
            this.startDateField = startDate;
            return this;
        }



        /// <summary>
        /// Checks if StartDate property is set
        /// </summary>
        /// <returns>true if StartDate property is set</returns>
        public Boolean IsSetStartDate()
        {
            return  this.startDateField != null;

        }


        /// <summary>
        /// Gets and sets the EndDate property.
        /// </summary>
        [XmlElementAttribute(ElementName = "EndDate")]
        public String EndDate
        {
            get { return this.endDateField ; }
            set { this.endDateField= value; }
        }



        /// <summary>
        /// Sets the EndDate property
        /// </summary>
        /// <param name="endDate">EndDate property</param>
        /// <returns>this instance</returns>
        public SellerListing WithEndDate(String endDate)
        {
            this.endDateField = endDate;
            return this;
        }



        /// <summary>
        /// Checks if EndDate property is set
        /// </summary>
        /// <returns>true if EndDate property is set</returns>
        public Boolean IsSetEndDate()
        {
            return  this.endDateField != null;

        }


        /// <summary>
        /// Gets and sets the Status property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Status")]
        public String Status
        {
            get { return this.statusField ; }
            set { this.statusField= value; }
        }



        /// <summary>
        /// Sets the Status property
        /// </summary>
        /// <param name="status">Status property</param>
        /// <returns>this instance</returns>
        public SellerListing WithStatus(String status)
        {
            this.statusField = status;
            return this;
        }



        /// <summary>
        /// Checks if Status property is set
        /// </summary>
        /// <returns>true if Status property is set</returns>
        public Boolean IsSetStatus()
        {
            return  this.statusField != null;

        }


        /// <summary>
        /// Gets and sets the Quantity property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Quantity")]
        public String Quantity
        {
            get { return this.quantityField ; }
            set { this.quantityField= value; }
        }



        /// <summary>
        /// Sets the Quantity property
        /// </summary>
        /// <param name="quantity">Quantity property</param>
        /// <returns>this instance</returns>
        public SellerListing WithQuantity(String quantity)
        {
            this.quantityField = quantity;
            return this;
        }



        /// <summary>
        /// Checks if Quantity property is set
        /// </summary>
        /// <returns>true if Quantity property is set</returns>
        public Boolean IsSetQuantity()
        {
            return  this.quantityField != null;

        }


        /// <summary>
        /// Gets and sets the Condition property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Condition")]
        public String Condition
        {
            get { return this.conditionField ; }
            set { this.conditionField= value; }
        }



        /// <summary>
        /// Sets the Condition property
        /// </summary>
        /// <param name="condition">Condition property</param>
        /// <returns>this instance</returns>
        public SellerListing WithCondition(String condition)
        {
            this.conditionField = condition;
            return this;
        }



        /// <summary>
        /// Checks if Condition property is set
        /// </summary>
        /// <returns>true if Condition property is set</returns>
        public Boolean IsSetCondition()
        {
            return  this.conditionField != null;

        }


        /// <summary>
        /// Gets and sets the SubCondition property.
        /// </summary>
        [XmlElementAttribute(ElementName = "SubCondition")]
        public String SubCondition
        {
            get { return this.subConditionField ; }
            set { this.subConditionField= value; }
        }



        /// <summary>
        /// Sets the SubCondition property
        /// </summary>
        /// <param name="subCondition">SubCondition property</param>
        /// <returns>this instance</returns>
        public SellerListing WithSubCondition(String subCondition)
        {
            this.subConditionField = subCondition;
            return this;
        }



        /// <summary>
        /// Checks if SubCondition property is set
        /// </summary>
        /// <returns>true if SubCondition property is set</returns>
        public Boolean IsSetSubCondition()
        {
            return  this.subConditionField != null;

        }


        /// <summary>
        /// Gets and sets the Seller property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Seller")]
        public Seller Seller
        {
            get { return this.sellerField ; }
            set { this.sellerField = value; }
        }



        /// <summary>
        /// Sets the Seller property
        /// </summary>
        /// <param name="seller">Seller property</param>
        /// <returns>this instance</returns>
        public SellerListing WithSeller(Seller seller)
        {
            this.sellerField = seller;
            return this;
        }



        /// <summary>
        /// Checks if Seller property is set
        /// </summary>
        /// <returns>true if Seller property is set</returns>
        public Boolean IsSetSeller()
        {
            return this.sellerField != null;
        }






        /// <summary>
        /// XML fragment representation of this object
        /// </summary>
        /// <returns>XML fragment for this object.</returns>
        /// <remarks>
        /// Name for outer tag expected to be set by calling method. 
        /// This fragment returns inner properties representation only
        /// </remarks>


        protected internal String ToXMLFragment() {
            StringBuilder xml = new StringBuilder();
            if (IsSetExchangeId()) {
                xml.Append("<ExchangeId>");
                xml.Append(EscapeXML(this.ExchangeId));
                xml.Append("</ExchangeId>");
            }
            if (IsSetListingId()) {
                xml.Append("<ListingId>");
                xml.Append(EscapeXML(this.ListingId));
                xml.Append("</ListingId>");
            }
            if (IsSetASIN()) {
                xml.Append("<ASIN>");
                xml.Append(EscapeXML(this.ASIN));
                xml.Append("</ASIN>");
            }
            if (IsSetSKU()) {
                xml.Append("<SKU>");
                xml.Append(EscapeXML(this.SKU));
                xml.Append("</SKU>");
            }
            if (IsSetUPC()) {
                xml.Append("<UPC>");
                xml.Append(EscapeXML(this.UPC));
                xml.Append("</UPC>");
            }
            if (IsSetEAN()) {
                xml.Append("<EAN>");
                xml.Append(EscapeXML(this.EAN));
                xml.Append("</EAN>");
            }
            if (IsSetWillShipExpedited()) {
                xml.Append("<WillShipExpedited>");
                xml.Append(this.WillShipExpedited);
                xml.Append("</WillShipExpedited>");
            }
            if (IsSetWillShipInternational()) {
                xml.Append("<WillShipInternational>");
                xml.Append(this.WillShipInternational);
                xml.Append("</WillShipInternational>");
            }
            if (IsSetTitle()) {
                xml.Append("<Title>");
                xml.Append(EscapeXML(this.Title));
                xml.Append("</Title>");
            }
            if (IsSetPrice()) {
                Price  price = this.Price;
                xml.Append("<Price>");
                xml.Append(price.ToXMLFragment());
                xml.Append("</Price>");
            } 
            if (IsSetStartDate()) {
                xml.Append("<StartDate>");
                xml.Append(EscapeXML(this.StartDate));
                xml.Append("</StartDate>");
            }
            if (IsSetEndDate()) {
                xml.Append("<EndDate>");
                xml.Append(EscapeXML(this.EndDate));
                xml.Append("</EndDate>");
            }
            if (IsSetStatus()) {
                xml.Append("<Status>");
                xml.Append(EscapeXML(this.Status));
                xml.Append("</Status>");
            }
            if (IsSetQuantity()) {
                xml.Append("<Quantity>");
                xml.Append(EscapeXML(this.Quantity));
                xml.Append("</Quantity>");
            }
            if (IsSetCondition()) {
                xml.Append("<Condition>");
                xml.Append(EscapeXML(this.Condition));
                xml.Append("</Condition>");
            }
            if (IsSetSubCondition()) {
                xml.Append("<SubCondition>");
                xml.Append(EscapeXML(this.SubCondition));
                xml.Append("</SubCondition>");
            }
            if (IsSetSeller()) {
                Seller  seller = this.Seller;
                xml.Append("<Seller>");
                xml.Append(seller.ToXMLFragment());
                xml.Append("</Seller>");
            } 
            return xml.ToString();
        }

        /**
         * 
         * Escape XML special characters
         */
        private String EscapeXML(String str) {
            StringBuilder sb = new StringBuilder();
            foreach (Char c in str)
            {
                switch (c) {
                case '&':
                    sb.Append("&amp;");
                    break;
                case '<':
                    sb.Append("&lt;");
                    break;
                case '>':
                    sb.Append("&gt;");
                    break;
                case '\'':
                    sb.Append("&#039;");
                    break;
                case '"':
                    sb.Append("&quot;");
                    break;
                default:
                    sb.Append(c);
                    break;
                }
            }
            return sb.ToString();
        }




    }

}